package com.example.webweb.api;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
 * 自定义校验验证接口
 */
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = MyCustomValidator.class)  // 指定校验器
public @interface MyCustomConstraint {
    String message() default "Invalid value";  // 错误消息
    Class<?>[] groups() default {};
    Class<? extends Payload>[] payload() default {};
}